package test.test_7_6;

import java.util.Arrays;

/*
把字符串"legendary"中字符 改成间隔大写小写模式，
即 "LeGeNdArY"
提示:
借助API
Character.toUpperCase把字符转换成大写
 */
public class Demo02 {
    public static void main(String[] args) {
        String str = "legendary";
        char[] charArray = str.toCharArray();

        String strResult = "";
        for (int i = 0; i < charArray.length; i++) {
            if (i % 2 == 0) {
                charArray[i] = Character.toUpperCase(charArray[i]);
            }
            strResult = strResult + charArray[i];
        }
        System.out.println(strResult);//结果：LeGeNdArY


//        String s = charArray.toString();//看源码
//        System.out.println(s);//[C@7ef20235


    }
}
